package presentation.frame;

import java.awt.Color;
import java.rmi.RemoteException;
import javax.swing.*;
import data.entity.*;


import presentation.redesign.Panel;

public class Frame extends JFrame {

	private static JPanel contentPane;

	/**
	 * Launch the application.
	 * @throws RemoteException 
	 */

	 static UserEntity ue;


	/**
	 * Create the frame.
	 * @throws RemoteException 
	 */
	public Frame(UserEntity ue) throws RemoteException {
		this.ue =ue;
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(120, 10, 1100, 700);
		this.setBackground(Color.white);
		this.ue=ue;
		contentPane = new JPanel();
		setContentPane(contentPane);
		contentPane.setLayout(null);
			
		EndPane endPanel=new EndPane();
		endPanel.setBounds(0, 620, 1100, 42);
		
		contentPane.add(endPanel);
		setVisible(true);
		
		TitlePane titlePanel = new TitlePane(ue);
		titlePanel.setBounds(0, 0, 1100, 80);
		
		contentPane.add(titlePanel);
		
		SecTitlePane sec=new SecTitlePane(ue);
		
		contentPane.add(sec);
		sec.setBounds(0, 80, 1100, 40);
		setVisible(true);
	}
	public static void main(String[] args) throws RemoteException {
		UserEntity user=new UserEntity("abc","123");
		Frame frame=new Frame(user);
	}


	public static void addPane(Panel p){
		contentPane.add(p);
		contentPane.repaint();
	}
	
	public static void removePane(){
		contentPane.removeAll();
		contentPane.add(new EndPane());
		contentPane.add(new TitlePane(ue));
		contentPane.add(new SecTitlePane(ue));
		contentPane.repaint();
	}

}
